Add Method (TKey, TValue)

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Adds a new key-value pair to the dictionary.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public virtual void Add(
	TKey key,
	TValue value
)
Visual Basic (Declaration)
Public Overridable Sub Add ( _
	key As TKey, _
	value As TValue _
)
Visual C++
public:
virtual void Add (
	TKey key, 
	TValue value
)

Parameters

key
TKey
Key to add.
value
TValue
Value to associated with the key.

Remarks

The default implementation of this method checks to see if the key already exists using ContainsKey, then calls the indexer setter if the key doesn't already exist.

Exceptions

ExceptionCondition
System..::ArgumentExceptionkey is already present in the dictionary

See Also